package com.test.test4;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

public class Reducer4 extends Reducer<LongWritable, Text, Text, Text> {
    final Text k = new Text();
    final Text v = new Text();

    @Override
    protected void reduce(LongWritable key, Iterable<Text> values, Context context) throws IOException, InterruptedException {
        for (Text value : values) {
            String line = value.toString();
            String[] split = line.split(",");
            k.set(split[0] + ",");
            v.set(split[1]);
            context.write(k, v);

        }
    }
}
